﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace MakeIT_Bill_Maker
{
    public partial class Main : Form
    {
        private ContextMenu menu = new ContextMenu();
        MenuItem itemShowDetails = new MenuItem("View Details...");
        MenuItem itemSetPaid = new MenuItem("Recieve Payment");
        public Main()
        {
            InitializeComponent();
        }

        private void showApt_Click(object sender, EventArgs e)
        {
            showAppartment f = new showAppartment();
            f.Show();
        }

        private void addApt_Click(object sender, EventArgs e)
        {
            AddAppartment f = new AddAppartment();
            f.Show();
        }

        private void btnReport_Click(object sender, EventArgs e)
        {
            Report.PdfReport report = new Report.PdfReport();
            report.printPdf();
        }

        private void btnCharges_Click(object sender, EventArgs e)
        {
            frmCharges f = new frmCharges();
            f.Show();
        }

        // 'Edit Arrears' Button
        private void btnEditArrears_Click(object sender, EventArgs e)
        {
            frmEditArrears f = new frmEditArrears();
            f.Show();
        }

        private void btnReading_Click(object sender, EventArgs e)
        {
            frmReading f = new frmReading();
            f.Show();
        }

        // 'Edit Penalty Rate' Button
        private void btnEditFC_Click(object sender, EventArgs e)
        {
            frmEditFixedChargers f = new frmEditFixedChargers();
            f.Show();
        }

        // 'Add Payment' Button
        private void btnAddPayment_Click(object sender, EventArgs e)
        {
            frmAddPayment f = new frmAddPayment();
            f.Show();
        }

        // 'Edit Apartment' Button
        private void btnEditApartment_Click(object sender, EventArgs e)
        {
            EditApartment f = new EditApartment();
            f.Show();
        }

        // 'Edit Report Details' Button
        private void btnEditReportDetails_Click(object sender, EventArgs e)
        {
            EditReportDetails f = new EditReportDetails();
            f.Show();
        }

        // 'Statistics' Button
        private void button1_Click(object sender, EventArgs e)
        {
            Statistics f = new Statistics();
            f.Show();
        }

        private void Main_Load(object sender, EventArgs e)
        {
            // TODO: This line of code loads data into the 'makeITDataSet.UsersMonthly' table. You can move, or remove it, as needed.
            this.usersMonthlyTableAdapter.GetUnpaid(this.makeITDataSet.UsersMonthly);

            menu.MenuItems.Add(itemShowDetails);
            menu.MenuItems.Add(itemSetPaid);
        }

        private void fillByToolStripButton_Click(object sender, EventArgs e)
        {
            try
            {
                this.usersMonthlyTableAdapter.FillBy(this.makeITDataSet.UsersMonthly);
            }
            catch (System.Exception ex)
            {
                System.Windows.Forms.MessageBox.Show(ex.Message);
            }

        }
    }
}
